using System.Security.Cryptography;
using System.Text;

namespace DTFramework.Util
{
    /// <summary>
    /// 加密，解密
    /// </summary>
    public static class EncryptUtil
    {
        /// <summary>
        /// 32位MD5加密
        /// </summary>
        public static string Md5Encrypt32(string text)
        {
            var data = Encoding.UTF8.GetBytes(text);
            var md5 = MD5.Create();
            byte[] result = md5.ComputeHash(data);
            var stringBuilder = new StringBuilder(40);
            for (int i = 0; i < result.Length; i++)
            {
                //加密结果"x2"结果为32位,"x3"结果为48位,"x4"结果为64位
                stringBuilder.Append(result[i].ToString("x2"));
            }
            return stringBuilder.ToString();
        }

    }
}